-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: consolidate DBW pass into defaultPass #2160
Conversation
bueller...bueller... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through the gatherers added to defaultPass and verified they only run in afterPass
and audited their driver usage.
The speed improvement is real and I'm excited to see this happen. 👍
lighthouse-core/audits/audit.js
Outdated
* @param {!RegExp} pattern | ||
* @return {!Array} | ||
*/ | ||
static getViolationResults(artifacts, pattern) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically this should be in a violation-audit.js
file that others subclass, right?
kind of an abuse to put in on the general audit file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
@@ -118,18 +118,16 @@ class EventListeners extends Gatherer { | |||
})).then(nestedListeners => [].concat(...nestedListeners)); | |||
} | |||
|
|||
beforePass(options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change fixes the 2nd half of #2163
and doing it this way means we don't need pavel's CL
\o/
patrick, you should followup with pavel separately if you'd rather migrate to violations vs this approach. but this can be post-IO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no strong opinions, are the mutation listeners bad enough that we should put them in everyone's console or just check for in LH? basically, is there a legitimate reason to still use them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically, is there a legitimate reason to still use them?
no. you can use mutation observers. but the events are from a dark time.
only really shitty legacy code should be using them. i hope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright cool then violation sgtm
this._parsedScripts = new Map(); | ||
return Promise.resolve() | ||
.then(() => this.listenForScriptParsedEvents()) | ||
.then(() => this.unlistenForScriptParsedEvents()) | ||
.then(_ => options.driver.querySelectorAll('body, body /deep/ *')) // drill into shadow trees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want to fix the 1st half of #2163
we're awfully close to it right now.
i'm also fine with it coming in separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to separate there's already a lot going on here
@@ -104,6 +86,7 @@ function filteredAndIndexedByUrl(networkRecords) { | |||
// Include 404 scripts/links generated by the parser because they are likely blocking. | |||
if (isHtml || isParserScriptOrStyle || (isFailedRequest && isParserGenerated)) { | |||
prev[record._url] = { | |||
isLinkPreload: record.isLinkPreload, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a little new.
CL: https://codereview.chromium.org/2751023005
cr rev: 460094
it's not yet in stable chrome (58), but its in 59.
how do you want to handle stable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's not the end of the world to have it fire false positives for a while since there's now a mitigation that won't fire if it didn't actually occur before the paint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k. sgtm
@@ -121,8 +109,6 @@ module.exports = { | |||
"dobetterweb/external-anchors-use-rel-noopener", | |||
"dobetterweb/geolocation-on-start", | |||
"dobetterweb/link-blocking-first-paint", | |||
"dobetterweb/no-console-time", | |||
"dobetterweb/no-datenow", | |||
"dobetterweb/no-document-write", | |||
"dobetterweb/no-mutation-events", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably, we won't be getting the same level of detail now that we aren't listening the entire time. strange that it shows up when there are no entries though...
"gatherers": [ | ||
"chrome-console-messages", | ||
// "styles", | ||
// "css-usage", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets keep the commented out css-usage? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha, alright, it's more dangerous now though since uncommenting could really mess up everything in the perf pass
"dobetterweb/anchors-with-no-rel-noopener", | ||
"dobetterweb/appcache", | ||
"dobetterweb/domstats", | ||
"dobetterweb/optimized-images", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this gatherer, we flip Network
domain on and off.
i'm not sure why though. I suppose its for the 'Network.getResponseBody'
we do. there's a chance this method will work without network being enabled. lets doublecheck that? looking at response-compression.js, it appears to get response bodies while network is disabled:
(also driver.getRequestContent
exists now which it should probably use?)
it could be a problem because we may allow more network events into the devtoolsLog than what we intended. but yeah... if we dont need to enable/disable in there then let's remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need network here anymore after #2154
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sg. do you want to remove the network.enable/disable stuff in that gatherer now, then?
} | ||
} | ||
}, | ||
// 'no-mutation-events': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a comment about why its excluded right now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't need to be anymore I removed
}; | ||
} | ||
|
||
/** | ||
* @param {!Artifacts} artifacts | ||
* @param {string} tagFilter The tagName to filter on | ||
* @param {number=} endedBefore The trace milisecond timestamp that offending tags must have ended | ||
* before (typically first contentful paint). | ||
* @param {number=} loadThreshold Filter to resources that took at least this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loadDurationThreshold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}; | ||
} | ||
|
||
/** | ||
* @param {!Artifacts} artifacts | ||
* @param {string} tagFilter The tagName to filter on | ||
* @param {number=} endedBefore The trace milisecond timestamp that offending tags must have ended |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endTimeMax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need a push?
/** | ||
* @license | ||
* Copyright 2016 Google Inc. All rights reserved. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why were these audits removed!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were the only audits left that had perf impact and would need their own pass. Somewhere there was also a thread with @brendankenny on the dangers of letting these run during the perf pass which is also why I recommended not enabling them until we proved they had minimal impact.
From the PR description:
Deletes no-console-time and no-datenow since they monkeypatch functions with capture callsites
Fancier stuff that got removed could potentially be enabled during the perf pass depending on how heavy the callsite capturing is, but further testing is needed
Right but can't we keep the code around for people to run themselves?
…On Tue, May 30, 2017, 9:35 AM Patrick Hulce ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In lighthouse-core/audits/dobetterweb/no-console-time.js
<#2160 (comment)>
:
> @@ -1,82 +0,0 @@
-/**
- * @license
- * Copyright 2016 Google Inc. All rights reserved.
- *
@ebidel <https://github.com/ebidel>
They were the only audits left that had perf impact and would need their
own pass. Somewhere there was also a thread with @brendankenny
<https://github.com/brendankenny> on the dangers of letting these run
during the perf pass which is also why I recommended not enabling them
until we proved they had minimal impact.
From the PR description:
Deletes no-console-time and no-datenow since they monkeypatch functions
with capture callsites
Fancier stuff that got removed could potentially be enabled during the
perf pass depending on how heavy the callsite capturing is, but further
testing is needed
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2160 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAOigDX2ps5IqF_EU4oPNtRfxkcT_Z-dks5r_EU6gaJpZM4NSOyM>
.
|
Oh sure I have no qualms with that 👍 I'll defer to @brendankenny who expressed disgruntlement at the time when I wanted to keep code around for unused audits :) |
in the name of Operation Yaquina Bay (#2146), closes #1737
shaves off ~40s on heavy sites like cnn.com (latest run when combined with other changes for me now completes in <1 minute 🎉 )
Changes:
afterPass
entries onlyno-console-time
andno-datenow
since they monkeypatch functions with capture callsitestags-blocking-first-paint
'sbeforePass
false positive detection into other checks usingisLinkPreload
flag and ensuring that the request actually finished before FCP.Caveats: